package br.com.mundodaprata.store.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@NamedQueries({@NamedQuery(name="neighborhoodByName", query="select n from Neighborhood n where n.name like :name")})
@Entity
@Table
public class Neighborhood extends AbstractEntity {
   
   private static final long serialVersionUID = 1L;
   
   @Id
   @Column
   private Long              code;
   
   @Column
   private String            name;
   
   @Column
   private String            acronym;
   
   @Column
   private String            state;
   
   @ManyToOne
   @JoinColumn(name="city")
   private City              city;
   
   public Long getCode() {
      return code;
   }
   
   public void setCode(Long code) {
      this.code = code;
   }
   
   public String getName() {
      return name;
   }
   
   public void setName(String name) {
      this.name = name;
   }
   
   public String getAcronym() {
      return acronym;
   }
   
   public void setAcronym(String acronym) {
      this.acronym = acronym;
   }
   
   public String getState() {
      return state;
   }
   
   public void setState(String state) {
      this.state = state;
   }
   
   public City getCity() {
      return city;
   }
   
   public void setCity(City city) {
      this.city = city;
   }
   
   @Override
	public String toString()
   	{
		StringBuilder sb = new StringBuilder();
		sb.append(getCode())
		  .append(" - ")
		  .append(getName());
		return sb.toString();
	}
}